package com.ms.framework.web.tags;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;

import com.ms.framework.util.StringUtil;


/**   
 * @see
 * @author ljy
 * @version 1.0
 * @preserve protected
 */
public class URLEncoderTag extends AbHtmlComponent {
	private String value;
	private String encoding="utf-8";
	public int doStartTag() throws JspException {
		if(!StringUtil.isEmpty(value)){
			JspWriter jw = this.pageContext.getOut();
			try{
				
				String s = java.net.URLEncoder.encode(this.value,encoding);
				jw.write(s);
			}catch(Exception e ){
				throw new JspException(e);
			}
		}
		return SKIP_BODY;
	}
	public void setEncoding(String encoding) {
		this.encoding = encoding;
	}
	public void setValue(String value) {
		this.value = value;
	}
}
